<?php
	if (!session_id()) session_start();
	require_once('web_fns.php');
	$user_id = $_POST['user_id'];
	$car_id = $_POST['car_id'];
	$user_type = $_POST['user_type'];
	if($user_type=="2") {
		if(!isset($_SESSION['user_id'])) {
			//未登录
			echo 4;
		}
		else 
			$user_id = $_SESSION['user_id'];
	}
	$check_result = make_order_check($user_id,$car_id,$car_dataset,$orders_table,$users_info,$user_type);
	switch($check_result){
		//提交成功，生成订单
		case "1":
			echo 1;
			break;
		//因为系统原因提交失败
		case "0":
			echo 0;
			break;
		
		//购物车中存在被卖掉/下架的车
		case "2":
			echo 2;
			break;
		//车已在预约单里面
		case "3":
			echo 3;
			break;
		default:;
		
	}
?>